class MyThread extends Thread{
    @Override
    public void run() {
        System.out.println("继承Thread 类");
    }
}

class MyRunnable implements Runnable {
    @Override
    public void run() {
        System.out.println("实现 Runnable 接口");
    }
}

public class Demo1 {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            System.out.println("lambda 表达式");
        });

        Thread t2 = new Thread() {
            @Override
            public void run() {
                System.out.println("Thread  匿名内部类");
            }
        };

        Runnable r = new Runnable() {
            @Override
            public void run() {
                System.out.println("实现 Runnable 接口， 匿名内部类");
            }
        };

        Thread t3 = new Thread(r);

        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("1");
            }
        });
        t.start();
        System.out.println("2");
    }
}
